home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / tools / falc_uti / falcextn / falcextn.txt < prev    next >
Text File  |  1995-11-25  |  40KB  |  1,126 lines

  1. Instructions for the Falcon Extension (v1.1a)
  2.  
  3. Contents
  4.  
  5.    * Introduction.
  6.         o Introduction.
  7.         o Getting STOS to run on the Falcon.
  8.         o Registering this software.
  9.    *  Command descriptions :-
  10.         o General
  11.              + cache
  12.              + cookie
  13.              + falc help
  14.              + jagpad
  15.              + lfalc help
  16.              + monitor
  17.              + os version
  18.              + set cache
  19.         o Graphics
  20.              + cycle
  21.              + df video
  22.              + falc bar
  23.              + falc box
  24.              + falc cls
  25.              + falc colour
  26.              + falc draw
  27.              + falc ink
  28.              + falc mkey
  29.              + falc mouse off
  30.              + falc mouse on
  31.              + falc plot
  32.              + falc set mouse
  33.              + falc set zone
  34.              + falc x mouse
  35.              + falc y mouse
  36.              + falc zone
  37.              + fpal
  38.              + gdos font
  39.              + goraud
  40.              + init goraud
  41.              + init virtual
  42.              + planes
  43.              + quick fade
  44.              + scrsize
  45.              + set fpal
  46.              + set fv
  47.              + set video
  48.              + st compat
  49.              + tc collide
  50.              + tc copy
  51.              + tc fade
  52.              + tc point
  53.              + tc scrn fade
  54.              + tc sprite
  55.              + tc text
  56.              + tga decode
  57.              + tga height
  58.              + tga width
  59.              + virtual
  60.              + xres
  61.              + yres
  62.         o Sound
  63.              + dsp clear
  64.              + dsp play
  65.              + dsp process
  66.              + dsp stop
  67.              + dtm inst
  68.              + dtm name
  69.              + dtm play
  70.              + dtm stop
  71.              + dtm voices
  72.              + falc freq
  73.              + falc mic thru
  74.              + falc sammde
  75.              + falc sam play
  76.              + falc sample
  77.              + falc sampos
  78.              + falc samstop
  79.              + set gain / lgain / rgain
  80.              + set volume / lvolume / rvolume
  81.              + speaker on/off
  82.              + tracker inst
  83.              + tracker name
  84.    * Commands in progress.
  85.    * Version history.
  86.    * Credits.
  87.  
  88. Introduction
  89.  
  90. This extension has been written to allow STOS to take advantage of the new
  91. facilities provided by the Atari Falcon. The current version only touches on
  92. some areas of the Falcons abilities very lightly. Future versions will
  93. hopefully go further, making programming the Falcon easier, without the need to
  94. resort to coding in assembler, or C.
  95.  
  96. To install the extension, simply copy the files FGRAPHIC.EXX and FAUDIO.EXY
  97. into the STOS folder, and FGRAPHIC.ECX, FAUDIO.EXY into the compiler directory.
  98.  
  99. When STOS initializes the graphics extension, it will select the correct Falcon
  100. resolution, so that STOS goes to a ST compatible screen rez, whatever you were
  101. in before running STOS. The initial resolution is not restored upon exit. In a
  102. screen mode where the vertical resolution is >=400 ST High will be chosen.
  103. Otherwise, ST Medium will be set. This will only be done on TOS 4 and above (-
  104. should TOS 5 every be released...).
  105.  
  106. This extension is SHAREWARE, so if you like it (or use it!!) then you should
  107. send me some money... See below for details.
  108.  
  109.  
  110. Getting STOS to run on the Falcon.
  111.  
  112. Due to the way that STOS was originally written, STOS does not work correctly
  113. on the Falcon without patching. Even with patching, not all of the bugs can be
  114. removed. Some of the problems encountered are listed below, along with a
  115. sollution.
  116.  
  117.    * Problem: The mouse does not respond.
  118.      Solution: Use STOS Fix 3.0 or above to patch basic206.prg
  119.    * Problem: The joysticks do not work.
  120.      Solution: Use STOS Fix 3.
  121.    * Problem: The keyclick goes wild.
  122.      Solution: Use STOS Fix 3 (not BASICMJH.PRG)
  123.    * Problem: Graphics functions dont work.
  124.      Solution: Un-patched. Use graphics functions from an extension. (This
  125.      one?)
  126.    * Problem: Computer crashes apon quiting.
  127.      Solution: Use STOS Fix 3.
  128.    * Problem: Change mouse to user defined doesn't work.
  129.      Solution: Un-patched. Use sprite x mouse,y mouse.
  130.    * Problem: Palettes are not correctly set.
  131.      Solution: try SET FPAL in this extension.....
  132.    * Problem: Running STOS from >= 400 vertical resolution mode does not work.
  133.      Solution: Install this extension! This will set it to ST High mode if this
  134.      is the starting resolution.
  135.  
  136. As you can see, STOS Fix is essential to use STOS on a Falcon. Remember that
  137. your compiled programs will suffer from the above problems unless they are also
  138. patched with STOS fix. I have found that if patched on TOS 4.04 they also work
  139. under TOS 4.01 and TOS 4.92a (hmmmm...). However, this should not be relied
  140. apon without further testing, and so, a note to this effect should be placed in
  141. the documentation of any released software.
  142.  
  143. STOS, will run under MultiTOS, so do not try.... I have found, however, that
  144. compiled versions sometimes work... give 'em a go!
  145.  
  146.  
  147. Registering.
  148.  
  149. This extension is shareware, and so, if you like it/use it, you owe me some
  150. money! As we all know, students are not the richest of people, so I can assure
  151. you that I could certainly use some cash...
  152.  
  153. I am only asking for 5 pounds (sterling), so it's not much....
  154.  
  155. If you register, you get a the latest version, along with a compiler that does
  156. not display the fact that you have not registered before running you program. I
  157. will also send you some example source code showing how to use some of the
  158. commands.
  159.  
  160. Registered users may write to me, with questions/requests and I will do my best
  161. to answer them. If you have internet access, I can send you all of the above
  162. via email (during the academic year), along with regular updates, if you want
  163. them...
  164.  
  165. If you dont feel that this extension is worth 5 pounds, write to me, telling me
  166. what is wrong with it (eg. commands/bugs etc), and I will try to fix it...
  167.  
  168. To register, simply send me 5 UK pounds (cheques payable to Anthony Jacques)
  169. at:
  170.  
  171. STOS Falcon Extension registrations,
  172. 70 West Avenue,
  173. Oldfield Park,
  174. Bath,
  175. Avon.
  176. BA2 3QD
  177. ENGLAND
  178.  
  179. or, during the 95/96 academic year,
  180.  
  181. STOS Falcon Extension registrations,
  182. Anthony Jacques
  183. 25 Balleratt Street
  184. Levensulme
  185. Manchester
  186. England
  187.  
  188.  
  189. Command descriptions.
  190.  
  191. Following is a list of the instructions/functions, and what they do.
  192.  
  193. Some of these instructions assume a Falcon. If a falcon specific instruction is
  194. called on an ST, I do not know what will happen. (I would guess a bus error or
  195. illegal instruction). The user should test what machine the program is running
  196. on first (either using os version, or cookie).
  197.  
  198.  
  199. General
  200.  
  201. x=cache
  202.  
  203. This function returns the current state of the '030 instruction and data
  204. caches. The result is represented by a sequence of bits. They are encoded in in
  205. the same way as in SET CACHE.
  206.  
  207. x=cookie(cook)
  208.  
  209. This function returns the value of the given cookie. If there is no cookie jar,
  210. or the cookie is not found, it returns a "Not Found" error.
  211.  
  212. eg.
  213. 10 print cookie("_MCH")
  214.  
  215. will print the value of the _MCH (machine) cookie. On a TOS 1.0 FM this will
  216. give the error message "Not Found in line 10."
  217.  
  218. A list of cookie ID's and the ascoiated meanings can be found on the WWW (email
  219. me for an address). The Atari cookies are also listed in Hisofts Modern Atari
  220. System Software - Appendix C.
  221.  
  222. falc help
  223.  
  224. This instruction displays on screen the syntax of each command available in
  225. this extension. This is designed to make it easier to use the commands.
  226.  
  227. As this is intended for editor use, this instruction cannot be compiled.
  228.  
  229. x=jagpad(port)
  230.  
  231. This function returns a binary value giving the state of each of the 21 keys on
  232. a Jaguar controller connected the the extended controller port PORT (0-1) The
  233. value returned allows the programmer to detect any combination of keys.
  234.  
  235. The bitwise representation of this value is :-
  236.  
  237. 1 4 7 * 3 6 9 # 2 5 8 0 o p c b a r l d u
  238.  
  239. Where o = option, p = pause, a/b/c = fire buttons r/l/d/u=directions, and the
  240. others are keys on the "phone pad".
  241.  
  242. Each bit can be tested by anding with the bitwise value
  243. ie
  244. 10 x=jagpad(0) : if (x and %10) then down
  245. 20 if (x and %1) then up
  246.  
  247. lfalc help
  248.  
  249. This instruction sends the help screen that is displayed by FALC HELP to the
  250. printer. This should be used if you do not intend to print out this manual.
  251.  
  252. As this is intended for editor use, this instruction cannot be compiled.
  253.  
  254. x=monitor
  255.  
  256. This returns the monitor type that is currently connected.
  257.  
  258. The form of x is :-
  259. 0 = ST mono monitor
  260. 1 = ST colour monitor
  261. 2 = (S)VGA monitor
  262. 3 = Television.
  263.  
  264. There is no method of distinguishing VGA and SVGA monitors. SVGA are capable of
  265. a wider range of frequencies and resolutions, but you will have to take the
  266. word of the user that their monitor can cope.
  267.  
  268. x=os version
  269.  
  270. This function returns the OS version. The radix point is not inserted, but is
  271. always two digits from the right. (eg. $404 = $4.04)
  272.  
  273. eg. 10 print hex$(os version)
  274.  
  275. set cache VALUE
  276.  
  277. This instruction sets the current state of the cache. VALUE is encoded in the
  278. following way:
  279.  
  280. x x x x x x x x x x x
  281. | | | | | | | | | | |__ Enable Intruction cache.
  282. | | | | | | | | | ----- Freeze instruction cache.
  283. | | | | | | | | ------- Clear instruction entry.
  284. | | | | | | | --------- Clear instruction cache.
  285. | | | | | | ----------- Instruction burst enable.
  286. | | | | | --- Enable data cache.
  287. | | | | ----- Freeze data cache.
  288. | | | ------- Clear data entry.
  289. | | --------- Clear data cache.
  290. | ----------- Data burst enable.
  291. ------ Write allocate
  292.  
  293. As you can see, it is quite complex. However, for optimum speed, a value of
  294. 12561 should be passed.
  295.  
  296. NOTE: Encoding technique is likely to change (to simply on/off).
  297.  
  298. Graphics
  299.  
  300. cycle index,count
  301.  
  302. This instruction cycles COUNT palette entries starting from INDEX in the
  303. Falcons 256 colour palette.
  304.  
  305. All of the palette handling routines also apply to the NON-ST COMPATABILITY
  306. bit-plane based modes (ie. not true colour, or ST comp.)
  307.  
  308. df videl n,h,s,o,p,v,8,c
  309.  
  310. This instruction defines a video mode N, which can range from 1-9. This mode is
  311. defined by the remaining flags. The value of these flags does not matter (with
  312. the exception of c) To set a flag, give a non-zero value. The meanings of thes
  313. flags are :-
  314.  
  315. h - vertical height (double line / interlace)
  316. s - ST compatibility mode
  317. o - overscan (enabled)
  318. p - PAL / NTSC (ie set = 50Hz, clear = 60 Hz)
  319. v - VGA mode
  320. 8 - set 80 column mode
  321. c - Number of colours. Valid values=2,4,16,256,65536. Other values give 2.
  322.  
  323. eg.
  324. df video 1,1,0,0,0,1,0,65536 would set 320x240x65536 on a VGA monitor
  325.  
  326. Please make ALL programs both VGA and RGB compatible. There is a small enough
  327. user base, even without dividing it!!!
  328.  
  329. NOTE: 640x?x65536 is not a valid mode for a VGA monitor....
  330.  
  331. falc bar col,x1,y1,x2,y1,scr
  332.  
  333. This instruction draws a filled bar on the screen at address SCR. This screen
  334. is assumed to be of the resolution / colour depth as the current one. The
  335. co-ordinates of the bar are given by x1,y1,x2,y2 assuming the first pair to be
  336. the top left corner, and the second the bottom right.
  337.  
  338. It is drawn in the current colour.
  339.  
  340. falc box x1,y1,x2,y2,scrn
  341.  
  342. This instruction draws a hollow box on the screen at address SCR. The screen is
  343. assumed to be of the same dimensions/colour depth as the current screen. The
  344. top left corner is drawn at the point (x1,y1), and the bottom left corner at
  345. the co-ordinates (x2,y2).
  346.  
  347. It is coloured with the current colour.
  348.  
  349. falc cls scr_address
  350.  
  351. This instruction clears the screen at the given address. It uses the blitter in
  352. HOG mode, so do not use if another extension is utilising the BLiTTER in
  353. interleave mode. The entire screen (even with a virtual screen) is filled with
  354. colour 0.
  355.  
  356. There have been a couple of errors caused by this command... untraced...
  357.  
  358. falc colour index,red,green,blue
  359.  
  360. This instruction sets colour number INDEX in the palette to the colour made up
  361. of the components RED,GREEN and BLUE. Each of these can range from 0-63. So,
  362. white is defined as 63,63,63.
  363.  
  364. falc draw screen,x1,y1,x2,y2
  365.  
  366. This instruction will draw a line in the currently selected colour on the
  367. screen at address SCREEN from coordinates X1,Y1 to X2,Y2. At the moment, only
  368. horizontal and vertical lines will be drawn, and only in true-colour modes.
  369. This will change soon...
  370.  
  371. falc ink index
  372.  
  373. falc ink red,green,blue
  374.  
  375. This instruction sets the current colour for all (my) graphics routines. The
  376. value index is the 16-bit colour value when in true-colour mode, otherwise it
  377. is the index of the colour in the palette (0-255).
  378.  
  379. If the three value version is used in true colour mode, then the three values
  380. will be combined to make the 16-bit colour from the red,green and blue
  381. components. It should be noted that to ensure that the collision bit is not
  382. set, an even value should be passed for green.
  383.  
  384. n=falc mkey
  385.  
  386. This funtion returns the state of the mouse buttons when using the mouse
  387. routine from this extension. The value return is encoded in the same way as the
  388. equivelent STOS routine - ie : 0=none, 1=left, 2=right, 3=both.
  389.  
  390. falc mouse off
  391.  
  392. This instruction switches off the Falcon extension mouse command, and restores
  393. the STOS mouse routine.
  394.  
  395. falc mouse on
  396.  
  397. This instruction enables a mouse routine which is able to go beyond the screen
  398. size of ST-high. It takes the maximum dimension of the screen from the current
  399. dimensions. Thus, if using a 800x600 virtual screen, this is the range of the
  400. mouse co-ordinates.
  401.  
  402. It should be noted, that unlike the STOS mouse routines, a pointer is NOT
  403. displayed at the current postition of the screen. If this is desired, tc
  404. sprite/tc copy can be used in true-colour mode.
  405.  
  406. falc plot screen,x,y
  407.  
  408. This instruction plots point (x,y) on screen with the current colour. The
  409. routine is faster than the STOS 'PLOT' command, even though it supports
  410. 4/16/256 and true-colour modes!!
  411.  
  412. falc set mouse x,y
  413.  
  414. This instruction sets the current position of the mouse cursor to the
  415. coordinates (X,Y) as given.
  416.  
  417. falc set zone n,x1,y1,x2,y2
  418.  
  419. This instruction defines a zone which can be tested for the presence of the
  420. mouse. X1,Y1 is the co-ordinate pair of the top-left corner of the box to be
  421. defined. X2,Y2 is the co-ordinates of the bottom right hand corner. N is the
  422. number of the zone to be defined, and may range from 0 to 63
  423.  
  424.  
  425.  
  426. n=falc x mouse
  427.  
  428. This function returns the x co-ordinate of the mouse pointer when using the
  429. mouse routine in this extension.
  430.  
  431. n=falc y mouse
  432.  
  433. This function returns the y co-ordinate of the mouse pointer when using the
  434. mouse routine in this extension.
  435.  
  436. n=falc zone(m)
  437.  
  438. This function returns whether or not zone number M contains the mouse-pointer
  439. or not. The value returned is either TRUE (-1) or FALSE (0)
  440.  
  441. fpal adr,index,count
  442.  
  443. This instruction copies the palette to the memory starting at ADR. INDEX is the
  444. number of the first palette to store, and COUNT is the number to store. The
  445. data is stored in the same format as SET FPAL.
  446.  
  447. gdos font n,addr
  448.  
  449. This instruction sets which font will be used by tc text. ADDR holds the
  450. address of the font, and N is the number of the font in the data to use (More
  451. than once size may be held in one data-block).
  452.  
  453. Although the routine uses GDOS fonts, currently only the system font is
  454. supported. This will change very soon. This routine has been included at this
  455. stage as not all OS versions have the font at the same address.
  456.  
  457. To find the system font in memory, use a memory searcher program (such as MON
  458. from devpac) to search for the string "system", as this is in the font name.
  459. The data should say "8x8 system font" (or 6x6 or 8x16). This address-4 should
  460. be passed to this instruction. On my TOS 4.04 Falcon the following addresses
  461. were found: (addresses as passed to instruction)
  462.  
  463.    * 6x6 - $e4afec
  464.    * 8x8 - $e4b6c8 (This address is used by default)
  465.    * 8x16- $e4d124
  466.  
  467. If a value of 0 is passed in ADDR, then the last address used will be retained.
  468. In my Falcon, if N is 1, and ADDR=8x8 font then the 8x16 is used.)
  469.  
  470. goraud scr,col,x1,y1,i1,x2,y2,i2,x3,y3,i3
  471.  
  472. This instruction draws a goraud shaded triangle on a true colour screen at
  473. address SCR. x1-x3 and y1-y3 are the co-ordinates of each of the three corners.
  474. i1-i3 are the relative inensities of the three points. This may range from 0 to
  475. $7fff.
  476.  
  477. The corners should be specified in a clock-wise direction.
  478.  
  479. COL determines the colour. The valid values are :-
  480. 0 - Red
  481. 1 - Green
  482. 2 - White
  483. 3 - Brown/orange
  484.  
  485. If the colour is anything other than these, it will be assumed to be the
  486. address of the colour table. The colour table consists of 32 words, each a true
  487. colour value. word no. 0 is the darkest and word no. 31 the brightest. This
  488. must be followed by 16 empty words.
  489.  
  490. NOTE: CANNOT BE COMPILED.
  491.  
  492. init goraud
  493.  
  494. This instruction sets up various parameters for the Goraud routine (see above).
  495. This MUST be called before goraud.
  496.  
  497. NOTE: CANNOT BE COMPILED.
  498.  
  499. init virtual xres,yres
  500.  
  501. This command initialises a virtual screen of dimensions XRES by YRES. The
  502. actual resolution of the screen / number of colours is determined by the
  503. current screenmode. Calling setvideo 0 will restore the screen.
  504.  
  505. x=planes
  506.  
  507. This function returns the number of bit-planes in the current screenmode. The
  508. values returned are 1,2,4,8 and 16.
  509.  
  510. x=quick fade(colour)
  511.  
  512. This function fades a 256 colour palette to the given colour. The colour is
  513. stored as a 18-bit number, where the top 6 bits represent the Red component,
  514. the next 6 are the Green component, and the bottom 6 bits are the Blue
  515. component.
  516.  
  517. The returned value, x is the number of palette entries changed.
  518.  
  519. NOTE: There seems to be some inteference at the top of the screen ?!?
  520.  
  521. x=scrsze(videomode)
  522.  
  523. This function returns the amount of memory taken for a given screenmode. The
  524. value VIDEOMODE is the number (0-9) of the defined video mode.
  525.  
  526. This function does not take account of any virtual screen, or expanded screen
  527. (using set fv)
  528.  
  529. set fpal addr,index,count
  530.  
  531. This instruction sets the Falcons 256 colour palette. ADDR stores the address
  532. at which the first palette entry is held. INDEX stores the first register to
  533. change, and count is the number of colour registers to change.
  534.  
  535. The data is stored longwords in the XRGB format of the XBIOS. An array can be
  536. used to hold the palette data, with the address passed using varptr.
  537.  
  538. eg.
  539. set fpal VARPTR(MYPAL(0)),0,256
  540.  
  541. set fv addr
  542.  
  543. This command allows the use of non-standard screen resolutions by setting the
  544. video registers to those specified in a FV (version 2) file. The address of the
  545. start of this file is passed in the parameter ADDR.
  546.  
  547. Note that FV files are, by their very nature, dangerous, as setting the
  548. registers to incorrect values could be harmful to your monitor. I take no
  549. responsibility for any problems caused by using this command. Having said this
  550. I have synced my SVGA up to 100Hz, and have had no adverse effects...
  551.  
  552. set video n
  553.  
  554. This instruction sets the video mode to a previously defined mode. N may range
  555. from 0-9. Video mode 0 is set to the video mode which is chosen at boot-up of
  556. STOS (ie ST Medium / ST High) - and is changed by the ST COMPAT command to the
  557. new default resolution.
  558.  
  559. On TOS < 4.04, when changing from an ST mode, a bus error / illegal
  560. instructions are caused by the operating system. Unfortunately, as STOS forces
  561. the Falcon into an ST mode, every time this instruction is executed on < TOS
  562. 4.04 it will crash your machine. If compatibility is essential, then use set fv
  563. to change the video mode.
  564.  
  565. st compat n
  566.  
  567. This command switches the video mode from one ST screen mode to another. It
  568. initialises both this extensions graphics commands, and the STOS routines for
  569. the new mode. N may range from 0 to 2, where 0 is ST Low and 2 is ST High.
  570.  
  571. The command should work on an ST (although cannot switch to ST High).
  572.  
  573. At this time, it is neccesary to use the DEFAULT command after this instruction
  574. as It does not completely re-initalise STOS. I hope to remove this problem.
  575.  
  576. x=tc collide
  577.  
  578. This command returns a value to indicate whether or not a collision occured
  579. during the previous sprite plot. A value of 0 is returned if no collision
  580. occured, or 1 if a collision was detected.
  581.  
  582. Unlike the STOS collide routine, this is pixel perfect - ie the object may be
  583. any shape, with only one pixel overlapping, and a collision will be detected.
  584. However, for this to work, somewhere the sensative parts of the screen (for
  585. backgrounds may also be sensative) must be stored. I have chosen to store this
  586. information in bit 5 (The LSB of the green part of the colour). This is because
  587. this bit does not make a noticable difference in colour, and it is used for
  588. other things (such as the genlock alpha channel).
  589.  
  590. The test is performed on any part of the sprite being ploted (non see-though)
  591. to test whether bit 5 is set in the background.
  592.  
  593. If using this command in conjunction with tc alpha, then ensure that bit 5 is
  594. not masked out by the alpha command.
  595.  
  596. tc copy scr1,x,y,w,h,scr2,x2,y2
  597.  
  598. This instruction copys a block of width W and Height H from the point (X,Y) on
  599. the screen at address SCR1 to the screen at address SCR2, with the top left
  600. corner at the point (X2,Y2). This instruction uses the BLiTTER chip in HOG mode
  601. to perform the operation, so do not use the blitter extension to start a copy
  602. in shared mode and then call this instruction.
  603.  
  604. NOTE: Dont pass -ive width and height parameters! I tried this, and it caused
  605. my machine to reboot, and trashed the NVRAM !!!!!
  606.  
  607. x = tc fade(length,address)
  608.  
  609. This function fades a True Colour screen towards the currently selected colour.
  610. The ADDRESS is the start of the screen to fade. LENGTH is the length of the
  611. part to fade. (ie the length of 1 screen if the whole screen is to be faded.)
  612.  
  613. The returned value is the number of pixels that were faded. When this value is
  614. zero, the whole screen has be faded to the given colour.
  615.  
  616. z=tc point screen,x,y
  617.  
  618. This returns the RGB value z, of the pixel on screen at coordinate (x,y) in
  619. True Colour mode. This command has the same purpose as the STOS command point.
  620.  
  621. tc scrn fade screen1,screen2,length
  622.  
  623. This instruction fades one True Colour screen into another. Simply pass the
  624. addresses of the screens as parameters, and the length.Both screens must be of
  625. the same size.
  626.  
  627. tc sprite x,y,n,scr,spr
  628.  
  629. This instruction draws a sprite created with Spooky Sprites (by Johan Karlsson
  630. - d92jk@efd.lth.se ) in true colour mode. X and Y are the co-ordinates at which
  631. to plot the sprite. N is the number of the sprite to draw. SCR is the address
  632. of the screen, and SPR is the address of the sprite bank.
  633.  
  634. Currently, clipping is only supported vertically on UNPACKED sprites. However,
  635. further support is on the way...
  636.  
  637. tc text screen,x,y,string$
  638.  
  639. This instruction will print the string stored in STRING$ on the screen at
  640. address SCREEN at coordinates X,Y. It will be printed in the current font (not
  641. the STOS one) The text is plotted in the currently set colour, using FALC
  642. COLOUR.
  643.  
  644. Future versions (very soon) will support GDOS fonts, stored at the given
  645. address. However, only fonts with the data in motorola format will be supported
  646. as I dont want to slow the printing down by supporting both Intel and Motorola
  647. formats.
  648.  
  649. INFO: Motorola / Intel format:
  650. Motorola format is where 2 byte values are stored HIGH BYTE | LOW BYTE. (ie
  651. with the bits from left to right decreasing in significance.)
  652.  
  653. Intel format is where 2 byte values are stored LOW BYTE | HIGH BYTE. Thus, to
  654. convert from one format to the other requires that the two bytes are switch
  655. order. I will supply a STOS program which will detect whether it is a motorola
  656. or intel font, and to convert an intel format one into a motorola. You are free
  657. to use it in any program you like to allow all GDOS (not Speedo) fonts to be
  658. used by you programs.
  659.  
  660. tga decode tga_addr,dest_addr
  661.  
  662. This instruction will decode a type 2 targa (.TGA) picture. The targa should be
  663. at the address TGA_ADDR, and the destination screen should be at DEST_ADDR. The
  664. screen is assumed to be of the correct size for the targa, and is assumed to be
  665. a true-colour screen.
  666.  
  667. To ensure that you reserve enough memory for the decoded picture, the size can
  668. be calculated by:
  669.  
  670. width * height * 2
  671.  
  672. The source and destination addresses should be different, as corruption will
  673. occur in most pictures - only those stored left-to-right and top-to-bottom will
  674. not be corrupted by decompressing over the original file.
  675.  
  676. The decode routine only supports type 2 targas. These are by far the most
  677. common type, and are uncompressed true colour images. (15/16/24/32 bit). The
  678. routine does however support any of the four orientations in which the picture
  679. may be stored.
  680.  
  681. x=tga height(addr)
  682.  
  683. This function returns the height in pixels of the targa at ADDR. This is useful
  684. for calculating the amount of space required for the picture.
  685.  
  686. x=tga width(addr)
  687.  
  688. This function returns the width in pixels of the targa at ADDR. This is useful
  689. for calculating the amount of space required for the picture.
  690.  
  691. virtual x,y,screen
  692.  
  693. This command positions the view-port in a virtual screen. The virtual screen
  694. should start at SCREEN, and X,Y should be the co-ordinates of the top-left
  695. pixel to be displayed on screen.
  696.  
  697. Currently in bit-plane modes, only screens with X a multiple of 16 will be
  698. displayed correctly. In true-colour mode, X must be a multiple of 2.
  699.  
  700. The virtual screen is achieved through the 'Hardware Scrolling' hardware, and
  701. so can be used to implement infinite scrollers...
  702.  
  703. X=xres
  704.  
  705. This function returns the horizontal resolution in pixels. This includes any
  706. virtual screen that is in use, and will take account of unusual modes defined
  707. with a .FV file.
  708.  
  709. Y=yres
  710.  
  711. This function returns the vertical resolution in pixels. This includes any
  712. virtual screen that is in use, and will take account of unusual modes defined
  713. with a .FV file.
  714.  
  715. Sound
  716.  
  717. dsp clear
  718.  
  719. This command can be used to reset the entire sound sub-system. It does this
  720. using the XBIOS call Sndstatus, however, it does not perform exactly as the
  721. system call.
  722.  
  723. The command flushes the DSP of all subroutines, and then tri-states it
  724. (disconnecting it from the sound-system). All DSP interupts are disabled, and
  725. all conections (not just the DSP) in the sound system are disconected. The
  726. sample playback resolution is set to 8-bit stereo, and all DMA transfers are
  727. halted.
  728.  
  729. However, unlike the XBIOS, the gain and attenuation (volume) settings are not
  730. cleared, and the PSG and the Matrix are both connected to the audio output.
  731.  
  732. This command should be used to clear the sound-system if an error occurs, or to
  733. remove a DSP routine which has been loaded in (either with TRAP or with the DSP
  734. PROCESS command).
  735.  
  736. All internal flags are cleared, and so, any play routines will not need the
  737. corresponding stop. (eg DTM PLAY start(14),155555 : DSP CLEAR would not need a
  738. DTM STOP command, as DSP CLEAR would do this.)
  739.  
  740. dsp play modaddress
  741.  
  742. This instruction plays a 4-track mod file on the DMA sound system using the
  743. DSP. This causes little slowdown, unlike other replay routines.
  744.  
  745. Due to a bug in part of the code (not by me), the file "dspmod.bsw" must be
  746. loaded each time a module is played. This file is read by the extension from
  747. the current directory. If the file could not be found, the "Not done" error
  748. will be returned.
  749.  
  750. (for those who wish to know why, the code cannot be run twice, as it seems to
  751. modify itself {or a variable} causing an illegal instruction.)
  752.  
  753. modaddress is the address at which the module can be found. If this is a memory
  754. bank, it must be specified as start(10), not as 10.
  755.  
  756. eg.
  757. 10 reserve as work 15,195636 : load "bubleman.mod",15 : dsp play
  758.  
  759. dsp process file$,buffer,mode
  760.  
  761. This instruction allows you to process audio data with the DSP. The DSP load
  762. file (.LOD) FILE$ is loaded into the dsp with the DSP_LoadProg call. BUFFER
  763. should point to an area of space which can be used to process the .LOD file.
  764. The size of this area is "3 * (length of program / data words + (3 * no of
  765. blocks in program))".
  766.  
  767. MODE is a value which indicates what you wish to be processed. There are
  768. currently 3 modes. These are:
  769.  
  770.    *  0 : Process audio through. Data is passed from the ADC -> DSP -> DAC, and
  771.      so provides real-time processing.
  772.    *  1 : Process audio record. Whenever FALC SAMPLE is called, the data is
  773.      passed via the DSP, enabling filtering etc. to be performed at record
  774.      time.
  775.    *  2 : Process audio playback, Whenever FALC SAM PLAY is called, the sample
  776.      is passed through the DSP, enabling effects to be performed on previously
  777.      recorded data.
  778.  
  779. A forth mode may be added, which takes a sample in memory, processes it, and
  780. places it back in memory. This would allow perminant processing.
  781.  
  782. For further details, see the example .LOD files, and related documentation.
  783.  
  784. dsp stop
  785.  
  786. This instruction stops the dsp module that currently is playing. If the mod is
  787. left playing, and the memory is re-allocated (eg exiting STOS), the code will
  788. cause a bus error (probably...)
  789.  
  790. X$=dtm inst (number,addr)
  791.  
  792. This function returns the name of instrument no. NUMBER in the DTM module at
  793. address ADDR. The name is returned in the form of a string. The instrument name
  794. is often used to store information about the module, writen by the composer.
  795.  
  796. eg.
  797.  
  798. 10 reserve as work 10,355000 : bload "test.dtm",10
  799. 20 i$=dtm inst(1,start(10)) : print i$
  800.  
  801. will print the name of the first instrument in the DTM module TEST.DTM.
  802.  
  803. x$=dtm name(addr)
  804.  
  805. This function returns a string containing the name of a DTM module at address
  806. ADDR.
  807.  
  808. eg.
  809.  
  810. 10 reserve as work 10,355000 : bload"test.dtm",10
  811.  
  812. 20 i$=dtm name(start(10)) : ? i$
  813.  
  814. will print the name of the module TEST.DTM
  815.  
  816. dtm play dtmaddr,length
  817.  
  818. This instruction plays a Digital Tracker Module using the DSP and the Audio
  819. sub-system. The address of this module should be passed in the dtmaddr
  820. parameter, and also the LENGTH of the file.
  821.  
  822. When reserveing the space for the module, you must reserve an extra 200000
  823. bytes, as this is used as temporary storage by the player routine.
  824.  
  825. The current version of the player only supports 8-bit mono samples, and only
  826. modules with an even number of voices (up to 32 tracks!!!)
  827.  
  828. NOTE: CANNOT BE COMPILED
  829.  
  830. dtm stop
  831.  
  832. This instruction stops a piece of DTM tracker music.
  833.  
  834. NOTE: CANNOT BE COMPILED
  835.  
  836. X=dtm voices addr
  837.  
  838. This function returns an the number of voices (or tracks) that the DTM module
  839. at address ADDR uses. This command can be used to test that the module uses an
  840. even number of tracks, as the current replay routine does not support modules
  841. with an odd number of tracks.
  842.  
  843. falc freq value
  844.  
  845. This instruction selects what frequency should be used for DMA sound (ie for
  846. DSP PROCESS, and FALC SAMPLE / SAMPLAY. The change will only take effect when
  847. the next command using the DMA is called.
  848.  
  849. There are 8 different frequencies available. These are coded in the following
  850. way:
  851.  
  852.   1 = 49170 Hz          5 = 16390 Hz
  853.   2 = 32780 Hz          7 = 12292 Hz
  854.   3 = 24585 Hz          9 =  9834 Hz
  855.   4 = 19668 Hz         11 =  8195 Hz
  856.  
  857. All other values will give a MUTE condition (ie it wont play....).
  858.  
  859. NOTE: The frequency encoding is likely to change, to allow for 50, 25.5 and
  860. 12.5 Khz freqencies also supported by the DMA.
  861.  
  862. Falc mic thru
  863.  
  864. This instruction toggles the microphone through, and the PSG output. Both are
  865. mixed with the output of the matrix (ie DMA/DSP). This can be used to allow the
  866. output of an external device such as a walkman through you Falcons speakers.
  867.  
  868. Falc sammde x
  869.  
  870. This instruction sets the resolution of sample playback. The value X gives the
  871. mode. Valid modes are :-
  872.  
  873. 0 - 8 bit stereo
  874. 1 - 16 bit stereo
  875. 2 - 8 bit mono
  876. This call does not effect recording mode - all recording is done at 16 bit
  877. stereo.
  878.  
  879. Falc samplay start,end,loop
  880.  
  881. Using this command a sample starting at address START and ending at END can be
  882. played on the Falcons DMA sound-system. The sample is played at the currently
  883. selected frequency.
  884.  
  885. The value LOOP indicates whether or not the sample should be looped. If the
  886. value is zero, the sample will not be looped, otherwise, it will be.
  887.  
  888. There are 8 different frequencies available. These are coded in the following
  889. way:
  890.  
  891.   1 = 49170 Hz          5 = 16390 Hz
  892.   2 = 32780 Hz          7 = 12292 Hz
  893.   3 = 24585 Hz          9 =  9834 Hz
  894.   4 = 19668 Hz         11 =  8195 Hz
  895.  
  896. All other values will give a MUTE condition (ie it wont play....).
  897.  
  898. NOTE: The frequency encoding is likely to change, to allow for 50, 25.5 and
  899. 12.5 Khz freqencies also supported by the DMA.
  900.  
  901. Falc sample start,end
  902.  
  903. This command uses the Falcons 16-bit sampling hardware to record a sample into
  904. memory starting at START. END is the end of the record buffer, and the sample
  905. will not exceed this buffer. Although it doesn't pass the end, sound can still
  906. be heard even when the buffer is full. Stop this with FALC MIC THRU.
  907.  
  908. The sample is recorded at the current frequency. Remember that all recording is
  909. done in 16-bit stereo, whatever mode has been set.
  910.  
  911. X=Falc sampos(mode)
  912.  
  913. This function returns the address of the current sample being played or
  914. recorded. Which is returned is determined by the value MODE. If mode=0, then
  915. the record pointer will be returned, otherwise, the playback pointer is
  916. returned.
  917.  
  918. There are two uses for this instruction. One to find the end of a sample.
  919.  
  920. Eg.
  921. 10 falc samplay strt,end,freq
  922. 20 repeat
  923. 30 until (falc sampos(0)>end)
  924. 40 falc samstop
  925.  
  926. This program would stop the sample when it reaches the end.
  927.  
  928. Or, alternatively, it can be used to find the current samples value.
  929. Eg.
  930. 10 falc sammde 0
  931. 20 falc samplay strt,end,freq
  932. 30 repeat
  933. 40 plot x,100 : x=peek(falc sampos(0)) : plot x,100
  934. 50 until (falc sampos(0)>end)
  935. 60 falc samstop
  936.  
  937. This program would play an 8-bit mono sample, and plot a single point on its
  938. waveform. This could be used to constuct an osciliscope display. If the sample
  939. is stereo, the right sample comes imedately after the left.
  940.  
  941. Falc samstop
  942.  
  943. This instruction halts all DMA sound interupts (both record and playback). Note
  944. that this does not disconnect the microphone throughput, or stop any PSG based
  945. sound.
  946.  
  947. set gain l,r / x=lgain / x=rgain
  948.  
  949. LGAIN and RGAIN return the left and right input gains. Set gain, sets the left
  950. and right gains to L and R. All values range from 0 to 15. Each step is a gain
  951. of 1.5 dB.
  952.  
  953. This is done with the XBIOS command (not using the memory location.)
  954.  
  955. set volume l,r / x=lvolume / x=rvolume
  956.  
  957. LVOLUME and RVOLUME return the left and right output volumes. Set volume sets
  958. the left and right volumes to L and R. All values range from 0 to 15. Each step
  959. is a decrease of 1.5 dB.
  960.  
  961. speaker on / speaker off
  962.  
  963. These two instructions switch on/off the internal speaker.
  964.  
  965. programs should give the user the choice of having it on/off, since not all
  966. users have external speakers, and VGA monitors do not include speakers.
  967.  
  968. X$=tracker inst (number,addr)
  969.  
  970. Like the command DTM INST, this function returns the name of instrument No.
  971. NUMBER in the .MOD module at the address ADDR.
  972.  
  973. tracker name (addr)
  974.  
  975. This command is similar to DTM NAME, and performs the same task - returning the
  976. name of a module at address ADDR, but for a .MOD module. The name is returned
  977. in the form of a string, which is never over 20 characters in length.
  978.  
  979. Instructions in progress
  980.  
  981. In the current version of this extension, incomplete instructions are included.
  982. These will, in general, cause some kind of error (eg bus / syntax) if called
  983. (plus I dont tell you the necessary parameters ;-)
  984.  
  985. I hope to replace all of the TC commands with a FALC version. This will detect
  986. the current screenmode, and draw etc. in the correct way. TC GORAUD may be an
  987. exception to this....
  988.  
  989. comming soon....
  990.  
  991.    * tc alpha - make TC sprites translucent.
  992.    * .AVR file support.
  993.    * optimised bitplane graphics.
  994.    * bitplane mode sprites.
  995.    * falc draw.
  996.    * Extension for registered users only. (watch out for more details...)
  997.  
  998. Version history :-
  999.  
  1000. Work for this extension began on 10 December 94 (I think).
  1001.  
  1002. V0.1
  1003.      First interpreter extension code (ever!!!)
  1004.      With instructions - set fv, get fv, cookie and speaker on / off, goraud
  1005.      (not working).
  1006. V0.2
  1007.      Added gain, attenuation, jagpad (not working), dsp play, dsp stop.
  1008.      Installed start-up code.
  1009. V0.3
  1010.      Removed set fv, get fv.
  1011.      Added set videl, videl, monitor, os version.
  1012.      Fixed DSP play.
  1013. V0.4
  1014.      Added tc fde, tc scrn fde, my fde, tc plt, tc pnt, scrsze.
  1015.      Fixed start-up for RGB (I think - not tested)
  1016.      Changed gain etc. to use XBIOS calls, rather than memory location.
  1017. V0.4a
  1018.      Fixed scrsze (typo), and added checking to DSP play/stop to prevent errors
  1019.      due to the other not being called ( ie DSP stop with no play) Finally
  1020.      coded jagpad (why did Atari make it so complex?!?)
  1021.      Completed quick fade,tc point and tc plot.
  1022. V0.5a
  1023.      Started cycle, and started falc play.
  1024.      Fixed gain/attenuation to accept variables.
  1025.      Started DTM play / stop.
  1026.      Replaced set l/r atten with set volume.
  1027.      Replaced video mode routines
  1028. V0.5b
  1029.      Complete re-write from v0.3 ish due to source code being wiped.
  1030.      Added TC sprite and falc sammde.
  1031.      TC FADE/TC SCRN FADE/TC PLOT/TC POINT no longer work....
  1032. V0.5c
  1033.      Fixed the above (TC) routines.
  1034.      Fixed sprite/graphics routines to work with all resolutions.
  1035. V0.6
  1036.      Fixed start-up for RGB. Fixed DSP play bug.
  1037.      Completed goraud / init goraud / dtm play / dtm stop.
  1038.      Added TC bar / TC box.
  1039.      Started virtual/init virtual.
  1040. V0.7
  1041.      Added TC copy / set fpal / fpal.
  1042.      Completed cycle.
  1043.      Changed quick fade to 18-bit parameter, from palette form. Compiler now
  1044.      coming on-line.....
  1045.      - TC BOX/TC BAR/TC PLOT/TC POINT/DF VIDEO/SET VIDEO/ OS
  1046.      VERSION/COOKIE/LVOLUME/RVOLUME/SET VOLUME/LGAIN/ RGAIN/SET GAIN/TC FADE/TC
  1047.      SCRN FADE/QUICK FADE/ TC SPRITE/SPEAKER ON/SPEAKER OFF/MONITOR/SAM MODE
  1048.      and SCR SZE all now work compiled.....
  1049. V0.8
  1050.      Added falc mic thru / falc samplay / falc samstop / falc sampos.
  1051.      Added falc sample / set fv
  1052.      Added above commands to compiler.
  1053.      Added FPAL/SET FPAL/CYCLE to compiler.
  1054.      Fixed set video for TOS 4.02 (I HOPE!!!!! - NO. Try again....)
  1055. V0.9
  1056.      Split extension into 2 parts - due to limit of size.
  1057.      Added dtm name, tracker name, dtm voices, dtm inst, tracker inst to both
  1058.      Compiler and Interpreter extensions.
  1059.      Fixed goraud for any polygon (not just trianges).
  1060.      Added dsp process and dsp clear, falc freq, falc ink
  1061.      Fixed dtm play/dsp play clash.
  1062. V0.9a
  1063.      Fixed a few Compiler bugs.
  1064.      Completed falc cls. Finished init virtual/virtual
  1065.      Fixed tc box bug.
  1066.      Started bitplane mode graphics routines...
  1067. V0.9b
  1068.      Completed bitplane graphics for 4/16/256 colours.
  1069.      Fixed compiler DSP play.
  1070.      Added set cache,cache.
  1071.      Added st compat
  1072. V1.0
  1073.      Goraud polygon back to only triangles (so that it actually works!!)
  1074.      Added falc colour
  1075.      Various bug-fixes
  1076.      Example code for registered version available.
  1077.      Un-registered compiler extension now has start up message.
  1078.      Added falc help and lfalc help.
  1079.      Added xres,yres and planes.
  1080.  
  1081. V1.0a
  1082.      Added tga width, tga height and tga decode.
  1083.      Fixed yres
  1084.      Fixed falc mouse clipping.
  1085.      Falc mouse now compiles.
  1086.      Finally fixed setvideo for TOS 4.02 (OS bug...)
  1087.      Fixed TC sprite for compiler
  1088.  
  1089. V1.1
  1090.      Added tc text and tc collide
  1091.      Fixed a couple of minor bugs.
  1092.      Started tc alpha.
  1093.      Started .AVR reading code.
  1094.      Started falc draw
  1095.  
  1096. V1.1a
  1097.      Added gdos font
  1098.      Fixed bugs in tc text
  1099.      Added collide to compiler
  1100.      Falc draw partially implemented
  1101.      Made mouse routine more stable in editor
  1102.  
  1103. Future versions may include other commands, as I think of how to do them....
  1104. (such as more graphics functions; FLI player; d2d play and more...)
  1105.  
  1106. Credits :-
  1107.  
  1108.    * True colour sprite routine : Johan Karlsson
  1109.    * True colour fade : Genie! of Network Trash
  1110.    * Goraud polygon : Griff
  1111.    * DTM replay code : Jaccard Emmanuel
  1112.    * DSP tracker code : bITmASTER of BSW
  1113.    * FV file format : Johan Karlsson
  1114.  
  1115. All the rest is by me (Anthony Jacques)
  1116.  
  1117. Cheers to RiCH Davey for testing/suggesting commands, and Les Greenhalgh for
  1118. the tips on extension writing...
  1119.  
  1120.  
  1121.  
  1122. Anthony Jacques
  1123.  
  1124. WWW:   http://www.cs.mna.ac.uk/~jacquesa/
  1125. email: jacquesa@cs.man.ac.uk
  1126.